{block name="title"}地址管理{/block}
{extend name="public/store_menu"}
{block name="content"}
<form class="mui-input-group" style="background-color: #fff0" action="{:Url('user/add_user_address')}" method="post" enctype="multipart/form-data" id="form1">
    <div class="mui-input-row">
        <label>用户名</label>
        <input type="text" class="mui-input-clear" placeholder="请输入用户名" name="real_name" value="{$address.real_name?=$address.real_name}">
    </div>
    <div class="mui-input-row">
        <label>联系号码</label>
        <input type="text" class="mui-input-clear" placeholder="请输入联系号码"  name="phone" value="{$address.phone?=$address.phone}">
    </div>
    <div class="mui-input-row">
        <label>所在地区</label>
        <input id="showCityPicker3" type="text" class="mui-input-clear" placeholder="请选择" value="{$address.region_name?=$address.region_name}">
        <input type="hidden" name="region_id" id="region_id" value="{$address.district?=$address.district}">

    </div>
    <div class="mui-input-row">
        <label>详细地址</label>
        <input type="text" class="mui-input-clear" placeholder="请填写详细地址"  name="detail" value="{$address.detail?=$address.detail}">
    </div>

    <div class="mui-input-row mui-checkbox  mui-left">
        <label>设为默认地址</label>
        <input name="is_default" value="1" type="checkbox"{$address.is_default?='checked'}>
    </div>
    {php}if(empty($id)):{/php}
    <button  style="margin-top: 10%" type="button" class="mui-btn mui-btn-primary mui-btn-block " onclick="Ajax('add_user_address')">提交</button>
    {php}else:{/php}
    <input type="hidden" class="mui-input-clear"  name="id" value="{$id}">
    <button  style="margin-top: 10%" type="button" class="mui-btn mui-btn-primary mui-btn-block " onclick="Ajax('edit_user_address')">修改</button>
    {php}endif;{/php}

</form>
<script>
        (function ($, doc) {
            $.init();
            $.ready(function () {
                //-----------------------------------------
                //					//级联示例
                var cityPicker3 = new $.PopPicker({
                    layer: 3
                });
                cityPicker3.setData(cityData3);
                var showCityPickerButton = doc.getElementById('showCityPicker3');
                var region_id = doc.getElementById('region_id');

                showCityPickerButton.addEventListener('tap', function (event) {
                    cityPicker3.show(function (items) {
                        showCityPicker3.value = (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
                        region_id.value =(items[2] || {}).value;
                        //返回 false 可以阻止选择框的关闭
                        //return false;
                    });
                }, false);
            });
        })(mui, document);
</script>
{/block}
{block name="caidan"}{/block}